package com.ruoyi.web.controller.business;

import com.ruoyi.business.domain.OrderManage;
import com.ruoyi.business.service.IRecordFormingOrderManageService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Jensen
 * @see
 * @since 2022/8/22
 */
@RestController
@RequestMapping("/recordforming/order")
public class RecordFormingOrderManageController extends BaseController {
    @Autowired
    private IRecordFormingOrderManageService recordFormingOrderManageService;

    @PreAuthorize("@ss.hasPermi('recordforming:order:receiveOrder')")
    @GetMapping("receiveOrder")
    public TableDataInfo receiveOrder(OrderManage orderManage) {
        return getDataTable(recordFormingOrderManageService.
                getOrderReceiveNumbers(String.valueOf(orderManage.getParams().get("startTime")), String.valueOf(orderManage.getParams().get("endTime"))));
    }

    @PreAuthorize("@ss.hasPermi('recordforming:order:source')")
    @RequestMapping("source")
    public TableDataInfo source(OrderManage orderManage) {
        return getDataTable(recordFormingOrderManageService.
                getOrderSourceNumbers(String.valueOf(orderManage.getParams().get("startTime")), String.valueOf(orderManage.getParams().get("endTime"))));
    }

    @PreAuthorize("@ss.hasPermi('recordforming:order:type')")
    @GetMapping("type")
    public TableDataInfo type(OrderManage orderManage) {
        return getDataTable(recordFormingOrderManageService.
                getOrderTypeNumbers(String.valueOf(orderManage.getParams().get("startTime")), String.valueOf(orderManage.getParams().get("endTime"))));
    }

    @PreAuthorize("@ss.hasPermi('recordforming:order:evolution')")
    @GetMapping("evolution")
    public TableDataInfo evolution(OrderManage orderManage) {
        return getDataTable(recordFormingOrderManageService.
                getOrderEvaluateNumbers(String.valueOf(orderManage.getParams().get("startTime")), String.valueOf(orderManage.getParams().get("endTime"))));
    }

    @PreAuthorize("@ss.hasPermi('recordforming:order:operateTime')")
    @GetMapping("operateTime")
    public TableDataInfo operateTime(OrderManage orderManage) {
        return getDataTable(recordFormingOrderManageService.
                getOrderOperateTimelinessNumbers(String.valueOf(orderManage.getParams().get("startTime")), String.valueOf(orderManage.getParams().get("endTime"))));
    }
}
